namespace Collaboris.Saf.Actions.Wss.Tests.Generated
{
    using System;
    using System.Web.UI.WebControls.WebParts;

    using Engine.Report;

    using Microsoft.SharePoint;
    using Microsoft.VisualStudio.TestTools.UnitTesting;
    using Saf.Tests;
    using Entities;

    using SharePoint.Wss.Files;
    using SharePoint.Wss.WebParts;

    using Wss.WebPart;

    /// <summary>
    /// This test was originally generated but has now been tested and verfiied by MJ
    /// </summary>
    [TestClass]
    public class AddWebPartsTest
    {
        [TestMethod]
        public void AddWebParts_Test()
        {
            WSSTestAssistant<AddWebParts, WebPartZoneInfo> addwebparts =
                    new WSSTestAssistant<AddWebParts, WebPartZoneInfo>(TestEnvironment.PublishingSite, 
                        "AddWebPartsTestWeb", "BLANKINTERNET#0");

            using (addwebparts)
            {
                SPFile defaultAspx = SPFileHelper.GetFile(addwebparts.TestWeb, "Pages", "default.aspx");
                SPFileHelper.CheckOutFile(defaultAspx);
                MacroReport doReport = addwebparts.DoMacro();

                WebPart webPart = SPWebPartHelper.GetWebPartFromPage(
                    addwebparts.TestWeb, 
                    String.Format(@"/{0}/{1}", addwebparts.FirstAction.FolderUrl, addwebparts.FirstAction.PageName),
                    "provider", 
                    PersonalizationScope.Shared);

                Assert.IsNotNull(webPart);

            }
        }

    }
}
